package com.demo.datastructure;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

/**
 * @description:
 * @author: ljr
 * @time: 2022/1/5 下午6:34
 */
public class Test {

    public static void main(String[] args) {
        System.out.println(199 / 10);
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(5);
        list.add(12);
        list.add(15);
        list.add(17);
        list.add(21);
        test2(list);
    }

    public static void test2(List<Integer> nums){
        int[] numArray = new int[10000];
        for(Integer integer : nums){
            int index = integer/10;
            int num = numArray[index]+1;
            numArray[index] = num;
        }
        System.out.println(numArray);
    }


    public static void test(List<Integer> nums){
        Map<Integer, Integer> nummap = nums.stream().collect(Collectors.toMap(t->t,t->t));
        int j = 0;
        int r = 0;
        for(int i = 0; i < 99999; i++){
            if(nummap.get(i) != null){
                j++;
            }

            if(i%10 == 0){
                r = i;
            }else if(i%10 == 9){
                System.out.println(i + "~" + r + "有"+ j+"个数");
                j = 0;
            }
        }
    }

}
